Learn R Programming

ks (version 1.3.2)

rmvnorm.mixt, dmvnorm.mixt: Multivariate normal mixture distribution

Description

Random generation and density values from multivariate normal mixture distribution.

Usage

rmvnorm.mixt(n=100, mus=c(0,0), Sigmas=diag(2), props=1)
dmvnorm.mixt(x, mus, Sigmas, props)

Arguments

n
number of random variates
x
matrix of quantiles
mus
(stacked) matrix of mean vectors
Sigmas
(stacked) matrix of variance matrices
props
vector of mixing proportions

Value

  • Multivariate normal mixture random vectors and density values.

Details

rmvnorm.mixt is based on the rmvnorm function from the mvtnorm library.

See Also

rmvt.mixt, dmvt.mixt

Examples

Run this code
mus <- rbind(c(-3/2,0), c(3/2,0))
Sigmas <- rbind(diag(c(1/16, 1)), rbind(c(1/16, 1/18), c(1/18, 1/16)))
props <- c(2/3, 1/3)
x <- rmvnorm.mixt(1000, mus, Sigmas, props)
dens <- dmvnorm.mixt(x, mus, Sigmas, props)

Run the code above in your browser using DataLab